package com.ray.anno;

import java.lang.reflect.Method;

public class InitTest {
    public static void main(String[] args) throws Exception {
        Class clazz = Class.forName("com.ray.anno.InitDemo");
        Method[] methods = clazz.getMethods();
        if(methods!=null){
            for (Method method : methods) {
                boolean isInitMethod = method.isAnnotationPresent(InitMethod.class);
                if(isInitMethod){
                    method.invoke(clazz.getConstructor(null).newInstance(null),null);
                }
            }
        }

    }
}
